
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<title>mojoQuery Test</title>
		<script>
//			document.querySelectorAll = null;
		</script>
		<script type="text/javascript" src="mojoQuery.js"></script>
		<style type="text/css">
			p {
				border: 1px dashed #abcabc;
				margin: 10px;
				text-align:center;
			}
			div {
				float:left;
			}
		</style>		
	</head>
	
	<body>
		<div id="div1"  class="fn">
		<p>1</p>
		<p>2</p>
		<p>3</p>
		<p>4</p>
		<p>5</p>
		<p>6</p>
		<p>8</p>
		<p>9</p>
		<p>10</p>
		<p>11</p>
		<p>12</p>
		<p>13</p>
		<p>14</p>
		<p>15</p>
		</div>
		
		<div id="div2" class="ff">
		<p>1</p>
		<p>2</p>
		<p>3</p>
		<p>4</p>
		<p>5</p>
		<p>6</p>
		<p>8</p>
		<p>9</p>
		<p>10</p>
		<p>11</p>
		<p>12</p>
		<p>13</p>
		<p>14</p>
		<p>15</p>
		</div>		
		
		<div>1
			<div>2
				<div>3
					<div>4</div>
				</div>
			</div>
		</div>
		
		<button onclick="test()">Test</button>
		
		<a id="testa" href="/" class="class">href</a>
	</body>
	
	<script type="text/javascript">
	
function test() {
		var both = ":nth-of-type(1)"
//		"div:not(a,b)>p:not(:not(p))"
//		"p:nth-child(2n)"
//		"div[ class = fn ]"
//		"div:not([class]:nth-child(1))";
//		"div.ff[class!=fn] > p:first-child, p:first-child"
//		"html [class!=fn]"
//		"div[class!=fn] ,div[class!=fn] ,div[class!=fn]"
//		"div[class!=fn] :first-child"
//		"div[class!=fn] p:first-child"
//			   "div[class!=fn] p";
//		       "div[class!=fn]";  
		
		var selector = "" + both;
		
		var arr = document.querySelectorAll(selector);
		for(var i = 0, len = arr.length; i < len; i++) {
			arr[i].aaaa = 1;
		}
		
		alert(len)
		
		var selector = "" + both;
		
		var arr = mojoQuery(selector);
		for(var i = 0, len = arr.length; i < len; i++) {
			if(arr[i].aaaa != 1) {
				arr[i].style.backgroundColor = "black";
			}
		}
		
		alert(len)

}
		
//var rules = /((?:#.+)*)([a-zA-Z*]*)([^\[:]*)((?:\[.+\])*)((?::.+)*)/g.exec("div.cls1.cls2[a]:a:cc");	
//alert(rules[1])
//alert(rules[2])
//alert(rules[3])
//alert(rules[4])
//alert(rules[5])

/*
		try{
			document.querySelectorAll(":not(*)");
		}catch (e) {
			alert(e)
		}
*/
//	alert(HTMLDocument.prototype.querySelectorAll)
/*
		var arr = /((?:#.+)*)([a-zA-Z*]*)([^\[:]*)((?:\[.+\])*)((?::.*[^:])*)/.exec(":d::a:b::c")
		
		alert(arr[5].match(/[^:]/g))
*/						
						
//						var re = /(?:_\d+_)+/g;
//						var arr;
//						while((arr = re.exec("div.cls_0_[~]_0__02_[~] p>a_0_~div")) !== null) {
//							//alert(arr[0])
//							alert(arr.index)
//							alert(re.lastIndex)
//							
//						}
//alert(/[!\^$*|]?=/.test(" class =example"))
//alert(RegExp["$&"])
//alert(RegExp["$`"])
//alert(RegExp["$'"])

//	alert(":not([a])".replace(new RegExp(":not\\((?::|)\\)"), "#"))

//var s = new Date().getTime();
//for(var i =0; i < 10000; i++) {
//	(i + "aaa").search();
//}
//
//alert(new Date().getTime() - s);

//alert(/(-?\d*)n([+-]?\d*)/.test("100n+6"))

	</script>
</html>
